from odoo import api, fields, models


class VaccineOrganization(models.Model):
    _name = "vaccine.organization"
    _description = "vaccine organization"

    name = fields.Char(
        '接种点名称',
        required=True
    )
    # 疫苗接种机构地址
    organization_address = fields.Char('疫苗接种机构地址', required=True)
    # 接种点ID
    organization_id = fields.Char(
        string='接种点编号',
        index=True,
        readonly=True,
    )

    @api.model
    def create(self, vals):
        vals['organization_id'] = self.env['ir.sequence'].next_by_code('vaccine.organization') or ''
        return super(VaccineOrganization, self).create(vals)

    # 疫苗接种类型
    vaccine_type = fields.Selection(
        [
            ('1', '第一类疫苗'),
            ('2', '第二类疫苗'),
            ('3', '第一类疫苗和第二类疫苗'),
        ],
        string='疫苗接种类型',
        required=True
    )
    # 疫苗接种机构
    organization = fields.Selection(
        [
            ('1', '本地疾病预防控制中心'),
            ('2', '医院门诊'),
            ('3', '其他'),
        ],
        string='疫苗接种机构',
        required=True
    )

    # 预防接种门诊等级
    vaccine_grade = fields.Selection(
        [
            ('1', 'A'),
            ('2', 'AA'),
            ('3', 'AAA'),
            ('4', 'AAAA'),
            ('5', 'AAAAA'),
        ],
        string='预防接种门诊等级',
        required=True
    )

    # 接种部位
    vaccine_position = fields.Selection(
        [
            ('1', '上臂三角肌'),
            ('2', '上臂外侧三角肌中部'),
            ('3', '上臂外侧三角肌中部附着处'),
            ('4', '上臂外侧三角肌附着处或臀部'),
            ('5', '上臂外侧三角肌下缘附着处'),
        ],
        string='接种部位',
        required=True
    )
    # 接种突进
    tujing = fields.Selection(
        [
            ('1', '肌内注射'),
            ('2', '肌肉注射'),
            ('3', '皮内注射'),
            ('4', '口服'),
            ('5', '皮下注射'),
            ('6', '肌肉或深度皮下注射'),
        ],
        string='接种突进',
        required=True
    )
    # 服务时间
    service_time = fields.Selection(
        [
            ('1', '周一上午'),
            ('2', '周一下午'),
            ('3', '周二上午'),
            ('4', '周二下午'),
            ('5', '周三上午'),
            ('6', '周三下午'),
            ('7', '周四上午'),
            ('8', '周四下午'),
            ('9', '周五上午'),
            ('10', '周五下午'),
        ],
        string='服务时间',
        required=True
    )
    # 联系电话
    phone = fields.Char('联系电话', required=True)
    # 备注
    comment = fields.Html('备注')
